Energy costs are rising as systems scale up and becoming an increasingly larger fraction of running datacenters, accounting for up to a substantial portion of the total expenditure and amounting to tens of millions of dollars per annum. To reduce these costs, efforts are being made in two different directions to combine traditional grid power (e.g., electric grid) and backup power (e.g., UPS and diesel generators) with renewable energy sources (e.g., solar, wave, tidal, and wind), and to exploit the variation of electricity prices both temporally and geographically (e.g., utility prices can change across different regions and even across the same region, based on diurnal patterns—peak and off-peak periods—or even significantly over a window of 5-15 minutes across the country).